//
//  @ Project : Galaxy Star Trading System
//  @ File Name : PortfolioPosition.h
//  @ Date : 2014/9/5
//  @ Author : 
//
//


#if !defined(_CPORTFOLIO_POSITION_H)
#define _CPORTFOLIO_POSITION_H

namespace GSTrader
{
	namespace TradeStrategy
	{
		class CPortfolio;
		class CStrategyBase;
		class TRADE_STRATEGY_API CPortfolioPosition : public CPositionBase
		{
		public:
			CPortfolioPosition(CPortfolio* pPortfolio, CExecutionReport& report);
			CPortfolioPosition(CPortfolio* pPortfolio, CPosition& position);
			CPortfolioPosition(CPortfolio* pPortfolio, int nInstrumentId, int nProviderId);
			virtual ~CPortfolioPosition();

			void Add(CExecutionReport& report);
			void Add(CPosition& position);

			CStrategyBase* GetStrategy();
			CPortfolioPosition& operator = (const CPortfolioPosition& r);

			string ToString();

		public:
			double m_dQty;
			double m_dLongQty;
			double m_dShortQty;
			double m_dNetQty;

			CTimePoint m_nOpenTime;
			double m_dOpenPrice;
			double m_dOpenQty;

			vector<int> m_vTrade;

			CPortfolio* m_pPortfolio;
		};
	}
}

#endif // _CPORTFOLIO_POSITION_H
